﻿#region
/*******************************************************************************
** File Name:		    OrganizationRepository.cs
** Creator:		        chao.jiang 
** EMail:               chao.jiang 
** Create date:	        
** Latest Modifier:
** Latest Modify date:
** Description:		    
** Modify History:
**
** Code Review:
**
** Version number:       1.0.0
*********************************************************************************/
#endregion
using System;
using System.Collections.Generic;
using Phoenix.Entity;
using Phoenix.Respository;
using IBatisNet.DataMapper;
using Phoenix.Data.IBatis;

namespace Phoenix.IBatisRepository
{
    public class OrganizationRepository : BaseIBatisDao,IOrganization
    {
    
		#region  Auto Generation

        public OrganizationRepository()
            : base("/Config/IBatis/86TCMap.Config")
        {

        }
        		
        public void AddOrganization(EOrganization entity)
        {
			string stmtId = "OrganizationMap.InsertOrganization";
			base.SqlMapper.Insert(stmtId, entity);
        }
        
		public  EOrganization GetByOrgID (System.Int32 orgID)
        {
			string stmtId = "OrganizationMap.SelectByOrgID";
			return base.SqlMapper.QueryForObject<EOrganization>(stmtId, orgID);
        }
        
        public  void DeleteByOrgID (System.Int32 orgID)
        {
			string stmtId = "OrganizationMap.DeleteByOrgID";
			base.SqlMapper.Update(stmtId, orgID);
        }
        
        public  void UpdateByOrgID (EOrganization entity)
        {
			string stmtId = "OrganizationMap.UpdateByOrgID";
			base.SqlMapper.Update(stmtId, entity);
        }


		#endregion

        public IList<EOrganization> GetNoDeleteByParentID(int parentID)
        {
            string stmtId = "OrganizationMap.SelecNoDeleteByParentID";

            return base.SqlMapper.QueryForList<EOrganization>(stmtId, parentID);
        }

        public IList<EOrganization> GetAllNoDelete()
        {
            string stmtId = "OrganizationMap.SelectAllNoDelete";

            return base.SqlMapper.QueryForList <EOrganization>(stmtId, null);
        }


    }
}

